const express = require('express');
const fs = require('fs');
const path = require('path');
const app = express();
app.get('/', (req, res) => {
    // res.download(source path,download name,callback)
    let vip = true;
    if(vip) {
        res.download(path.join(__dirname, 'music/夏婉安 - 一个人.mp3'), '夏婉安 - 一个人.mp3', (error) => {
            if(error) {
                console.log(error);
            }
            console.log('下载完成');
        })
    } else {
        res.send('不是vip');
    }
})
app.listen(80, () => {
    console.log('servering');
})